// Element Plus组件按需引入
import 'element-plus/dist/index.css'
import 'element-plus/es/components/message/style/css'
import 'element-plus/es/components/notification/style/css'
import 'element-plus/es/components/message-box/style/css'
import 'element-plus/es/components/loading/style/css'
import 'element-plus/theme-chalk/el-loading.css'
import 'element-plus/theme-chalk/el-message.css'
import 'element-plus/theme-chalk/base.css'

import {
	ElButton,
	ElInput,
	ElForm,
	ElFormItem,
	ElTable,
	ElTableColumn,
	ElPagination,
	ElDialog,
	ElSelect,
	ElOption,
	ElMenu,
	ElMenuItem,
	ElSubMenu,
	ElDropdown,
	ElDropdownItem,
	ElDropdownMenu,
	ElCard,
	ElTabs,
	ElTabPane,
	ElIcon,
	ElRow,
	ElCol,
	ElLoading,
	ElMessage,
	ElMessageBox,
	ElSkeleton,
	ElSkeletonItem,
	ElDatePicker,
	ElAlert,
	ElTooltip,
	ElPopover,
	ElUpload,
} from 'element-plus'

export default app => {
	// 注册组件
	app.use(ElButton)
	app.use(ElInput)
	app.use(ElForm)
	app.use(ElFormItem)
	app.use(ElTable)
	app.use(ElTableColumn)
	app.use(ElPagination)
	app.use(ElDialog)
	app.use(ElSelect)
	app.use(ElOption)
	app.use(ElMenu)
	app.use(ElMenuItem)
	app.use(ElSubMenu)
	app.use(ElDropdown)
	app.use(ElDropdownItem)
	app.use(ElDropdownMenu)
	app.use(ElCard)
	app.use(ElTabs)
	app.use(ElTabPane)
	app.use(ElIcon)
	app.use(ElRow)
	app.use(ElCol)
	app.use(ElSkeleton)
	app.use(ElSkeletonItem)
	app.use(ElDatePicker)
	app.use(ElAlert)
	app.use(ElTooltip)
	app.use(ElPopover)
	app.use(ElUpload)

	// 全局方法
	app.config.globalProperties.$message = ElMessage
	app.config.globalProperties.$msgbox = ElMessageBox
	app.config.globalProperties.$alert = ElMessageBox.alert
	app.config.globalProperties.$confirm = ElMessageBox.confirm
	app.config.globalProperties.$prompt = ElMessageBox.prompt
	app.config.globalProperties.$loading = ElLoading.service
}
